package com.scud.system.controller;

import com.scud.common.result.Result;
import com.scud.system.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/system/upload")
public class UploadController {
    @Autowired
    private UploadService uploadService;

    /**
     * 上传文件接口
     * @param file
     * @return
     */
    @PostMapping
    public Result<String> fileUpload(@RequestBody MultipartFile file){
        String fileUrl = uploadService.upload(file);
        return Result.success(fileUrl);
    }
}
